package com.wlts.wzy.KSUserModule.service.impl;

import com.wlts.wzy.KSUserModule.entity.KsStoreUser;
import com.wlts.wzy.KSUserModule.mapper.KsStoreUserMapper;
import com.wlts.wzy.KSUserModule.service.IKsStoreUserService;
import com.wlts.wzy.configBean.shiro.SysAuthorizationInfo;
import com.wlts.wzy.expand.MyLambdaQueryWrapper;
import com.wlts.wzy.redis.impl.ServiceWithRedisImpl;
import com.wlts.wzy.sys_shiro.entity.SysRole;
import com.wlts.wzy.sys_shiro.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * <p>
 * 快手授权信息 实现类
 * </p>
 *
 * @author zhiyong
 * @since 2021-02-01
 */
@Service
public class KsStoreUserServiceImpl extends ServiceWithRedisImpl<KsStoreUserMapper, KsStoreUser> implements IKsStoreUserService {
    @Autowired
    private ISysRoleService roleService;


    @Override
    public SysAuthorizationInfo getAuthor(String name) {

        SysAuthorizationInfo authorizationInfo = new SysAuthorizationInfo();

        List<SysRole> sysRoleList = roleService.list(new MyLambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, "0"));

        Set<String> stringSet = sysRoleList.stream().map(SysRole::getRolename).collect(Collectors.toSet());

        authorizationInfo.setRoles(stringSet);

        return null;
    }
}
